<?php

class GoSharkCreateGroupForm extends GofishGroupsForm
{
  public function configure()
  {
    $this->setWidgets(array(
      'group_name'      => new sfWidgetFormInputText(),
      'password'        => new sfWidgetFormInputPassword(),
    ));
    
    $this->setValidators(array(
      'group_name'        => new sfValidatorString(array('max_length' => 255, 'required' => true)),
      'password'         => new sfValidatorString(array('max_length' => 255, 'required' => true)),
    ));
    
    $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];

    $this->widgetSchema->moveField('password_again', 'after', 'password');

    $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));
  
    $this->widgetSchema->setNameFormat("createGroup_form[%s]");
  }
}

?>